home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-01 | 2.4 KB | 95 lines | [TEXT/KAHL] |
- * ***
- * Methods for a system error notifier
- *
- * Julian Barkway (c) October 1994. All rights reserved.
- *
- * v3.1.3 - Initial release.
- * v3.1.5 - Modify to use enhanced pane protocol.
- *
- * ***
-
- Class NotifierTextPane TextPane
- Class Notifier Object nWindow pMenu theText
-
- "Process::trace modified to write results to a string"
-
- Methods Process 'tracing'
- traceToMem | link m r s |
- " first yield scheduler, forcing store of linkPointer"
- scheduler yield.
- linkPointer isNil ifTrue: [
- ^ 'No trace-back data available'
- ].
- link <- linkPointer.
- link <- stack at: link + 1.
- s <- ''.
- " then trace back chain "
- [ link notNil ] whileTrue: [
- m <- stack at: link + 3.
- m notNil ifTrue: [
- s <- s , (m signature) , ' ( '.
- r <- stack at: link + 2.
- (r to: link-1) do: [:x |
- s <- s, ((stack at: x) class asString), ' '
- ].
- s <- s, ')', newLine
- ].
- link <- stack at: link
- ].
- ^ s
- ]
-
- Methods Smalltalk 'doit'
- error: aString | s txt |
- " print a message, and remove current process "
- txt <- scheduler currentProcess traceToMem.
- Notifier new; notify: aString withText: txt.
- (scheduler currentProcess) terminate
- ]
-
- Methods NotifierTextPane 'all'
- openOn: theText in: aWindow withBoundsFrom: topLeft to: bottomRight
- self boundsFrom: topLeft to: bottomRight;
- owner: self;
- attachTo: aWindow withSizing: (1 @ 1) andLineLength: (80 * 9);
- font: 'monaco'; fontSize: 9; print: theText.
- |
- createPopUpMenu
- pMenu <- PopUpMenu new; owner: self; create.
- pMenu addItem: 'Close' action: #close;
- addItem: 'Debug' action: #debug;
- disableItem: 2
- |
- close
- parentWindow close
- |
- debug
- ^ nil
- ]
-
- Methods Notifier 'all'
- notify: titleText withText: text
- theText <- text.
- self openOn: text withTitle: titleText
- |
- openOn: theText withTitle: aTitle
- | maxW maxH topCentre origin ww wh |
- maxW <- (smalltalk getMaxScreenArea) right.
- maxH <- (smalltalk getMaxScreenArea) bottom.
- topCentre <- (0@0).
- origin <- (0@0).
- topCentre x: ((maxW / 2) truncated); y: 150.
- origin <- topCentre - (175@0).
- maxW <- 350 min: ((origin x) + (maxW - 70)).
- maxH <- 100 min: ((origin y) + (maxH - 70)).
- self makePane: (Window new; title: aTitle; openAt: origin withSize: (maxW@maxH))
- withText: theText.
- |
- makePane: aWindow withText: theText
- | ww wh np |
- ww <- (aWindow size) x + 1.
- wh <- (aWindow size) y + 1.
- np <- NotifierTextPane new.
- np openOn: theText in: aWindow withBoundsFrom: (-1 @ -1) to: (ww @ wh)
- ]
-